<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<script type="text/javascript">
	var artActivityGrid = null;
	var editActivityDialog = null;
	var showActivityDialog=null;
	var updateActivityDialog=null;
	
	$(function(){
		artActivityGrid = $("#art_Activity_grid").ligerGrid({
				title : '活动列表',
                columns: [
				 { display: '当前状态', name: 'isShow',isSort : false,
	                  render: function(record, rowindex, value, column){
	                	  if(value){
	                		  return "<span>显示</span>"; 
	                	  }else{
	                		  return "<span>关闭</span>"; 
	                	  }
	                	 
	                  }}, 
	                  {
	                  	display: '<a href="javascript:;" onclick="addArtActivity()">添加活动</a>', 
	                  	name: 'identifier',
	                  	width:150 ,
	                  	isAllowHide: false, 
	                  	isSort : false,
	  					render: function (record, rowindex, value, column){
	  						var html = '<a onclick="showActivity(\''+ value + '\')" href="javascript:;">详情</a>&nbsp;<a onclick="updateActivity(\''+ value + '\')" href="javascript:;">更新</a>&nbsp;<a onclick="deleteActivity(\''+ value + '\')" href="javascript:;">删除</a>&nbsp;<a onclick="displayActivity(\''+ value + '\')" href="javascript:;">显示</a>&nbsp;<a onclick="hideActivity(\''+ value + '\')" href="javascript:;">关闭</a>&nbsp;'; 
	  						return html; 
	  					}
	                  },
	                  { display: '标题', name: 'title',isSort : false},
                { display: '开始日期', name: 'startDate', isSort : false },
                { display: '结束日期', name: 'endDate', isSort : false},
                { display: '开始时间', name: 'startTime', isSort : false},
                { display: '结束时间', name: 'endTime', isSort : false},
                { display: '详情', name: 'description', isSort : false},
                {
                  	display: '<a href="javascript:;" onclick="addArtRoom()">封面</a>', 
                  	name: 'cover',
                  	isAllowHide: false, 
                  	width: 100,
                  	isSort : false,
  					render: function (record, rowindex, value, column){
  						var html = '<a href="'+ value + '" target="_blank">查看</a>'; 
  						return html; 
  					}
                  },
                { display: '创建时间', name: 'gmtCreated',isSort : false,
                  render: function(record, rowindex, value, column){
                	 return (new Date(value.time)).format("yyyy年MM月dd日 hh:mm:ss");
                  }}
                ], 
                pageSize:30,
                root :'list',
                record:'totalRecord',
                url: "/misc/artActivity/artActivityGrid.htm", 
                width: '99%',height:'99%'
            });


	});
	//添加展览馆
	function addArtActivity(){
		editActivityDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/artActivity/addArtActivityWeb.htm", isResize: false ,modal:true,title:'添加活动'});
	
	}
	//详细情况
	function showActivity(ActivityId){
		showActivityDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/artActivity/showActivityDetail.htm?activityId="+ActivityId, isResize: false ,modal:true,title:'查看频道详情'});
	}
	//关闭/开启
	function displayActivity(ActivityId){
		$.post("/misc/artActivity/displayActivity.htm", {
			identifier:ActivityId
		},function(data){
			if(data=="success"){
				artActivityGrid.loadData();
				$.ligerDialog.success("开启成功！");
			}
			if(data=="error"){
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
		
	}
	//
	function hideActivity(ActivityId){
		$.post("/misc/artActivity/hideActivity.htm", {
			identifier:ActivityId
		},function(data){
			if(data=="success"){
				artActivityGrid.loadData();
				$.ligerDialog.success("关闭成功！");
			}
			if(data=="error"){
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
		
	}
	//删除展览馆
	function deleteActivity(activityId){
		$.post("/misc/artActivity/deleteActivity.htm", {
			identifier:activityId
		},function(data){
			if(data=="success"){
				artActivityGrid.loadData();
				$.ligerDialog.success("删除成功！");
			}
			if(data=="error"){
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
	}
	//更新
	function updateActivity(activityId){
		updateActivityDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/artActivity/updateActivityDetail.htm?activityId="+activityId, isResize: false ,modal:true,title:'更新活动详情'});
	}
</script>
<div id="art_Activity_grid" style="margin:0; padding:0; "  ></div>
